﻿
@{
    ViewBag.Title = "海关编码管理";
    Layout = "~/Views/Shared/_LayoutIndex.cshtml";
}
<script type="text/javascript">

    $(function () {
        GetGrid();
    })
    //加载表格
    function GetGrid() {
        


        $("#gridTable").jqGrid({
        @*url: "@Url.Content("~/CommonModule/BmsCustomItem/GridPageJson")",*@
        url: "@Url.Content("~/CommonModule/BmsCustomItem/GridListPageJson")",
        datatype: "json", 
        height: $(window).height() - 149,
        autowidth: true,
        colModel: [
            { label: 'BMS_CUSTOM_ITEM_ID', name: 'BMS_CUSTOM_ITEM_ID', index: 'BMS_CUSTOM_ITEM_ID', width: 0, hidden: true  },
            { label: 'HS_CODE', name: 'HS_CODE', index: 'HS_CODE', width: 0, align: 'left',sortable: true  },
            { label: '类别编码', name: 'HS_NO', index: 'HS_NO', width: 0, align: 'left', sortable: true, hidden: true },
            { label: '商品编码', name: 'SUB_CODE', index: 'SUB_CODE', width: 0, align: 'left', sortable: true, hidden: true },
            { label: '申报要素', name: 'ELEMENT_DEC', index: 'ELEMENT_DEC', width: 0, align: 'left', sortable: true },
            { label: '适用年份', name: 'YYYY', index: 'YYYY', width: 0, align: 'left',sortable: true  },
            { label: '商品名称', name: 'ITEM_DESC', index: 'ITEM_DESC', width: 0, align: 'left',sortable: true  },
            { label: '货物说明', name: 'REMARK', index: 'REMARK', width: 0, align: 'left',sortable: true  },
            { label: '普通税率', name: 'GENERAL_DUTY', index: 'GENERAL_DUTY', width: 0, align: 'left',sortable: true  },
            { label: '最惠国税率', name: 'PREFERENTIAL_DUTY', index: 'PREFERENTIAL_DUTY', width: 0, align: 'left',sortable: true  },
            { label: '曼协税率', name: 'BA', index: 'BA', width: 0, align: 'left',sortable: true  },
            { label: '出口退税', name: 'EXPORT_TAX', index: 'EXPORT_TAX', width: 0, align: 'left',sortable: true  },
            { label: '国内货物税', name: 'EXCISE', index: 'EXCISE', width: 0, align: 'left',sortable: true  },
            { label: '增值税率', name: 'VALUE_ADDED_TAX', index: 'VALUE_ADDED_TAX', width: 0, align: 'left',sortable: true  },
            { label: '监管条件', name: 'MONITOR_TERM', index: 'MONITOR_TERM', width: 0, align: 'left',sortable: true  },
            { label: '监管说明', name: 'MONITOR_DESC', index: 'MONITOR_DESC', width: 0, align: 'left',sortable: true  },
            { label: '商检类别', name: 'IC_TYPE', index: 'IC_TYPE', width: 0, align: 'left',sortable: true  },
            { label: '第一计量单位', name: 'MEASURE_CODE1', index: 'MEASURE_CODE1', width: 0, align: 'left',sortable: true  },
            { label: '第二计量单位', name: 'MEASURE_CODE2', index: 'MEASURE_CODE2', width: 0, align: 'left',sortable: true  },
            { label: '单价下限', name: 'PRICE_REF', index: 'PRICE_REF', width: 0, align: 'left',sortable: true  },
            { label: '单价上限', name: 'PRICE_REF_H', index: 'PRICE_REF_H', width: 0, align: 'left',sortable: true  },
            { label: '币别', name: 'CURRENCY_CODE', index: 'CURRENCY_CODE', width: 0, align: 'left',sortable: true  },
            { label: '项目定义', name: 'ITEM_DESC_EN', index: 'ITEM_DESC_EN', width: 0, align: 'left',sortable: true  },
            
        ],
        pager: "#gridPager",
        sortname: 'LAST_UPDATE_DATE',
        sortorder: 'desc',
        rownumbers: true,
        shrinkToFit: false,
            gridview: true,
            
    });
    }

    //搜索
    //var QueryParamJson = "";
    function btn_Search() {
        //var hsCode = $("#hsCode").val();
        //var itemName = $("#itemName").val();
        //var applyYyyy = $("#applyYyyy").val();
        //AjaxJson("/CommonModule/BmsCustomItem/GridListJson", { hsCode: hsCode, itemName: itemName, applyYyyy: applyYyyy}, function (data) {
        //    $("#gridTable").jqGrid("clearGridData", true).trigger("reloadGrid");
        //    //$("#gridTable").trigger("reloadGrid");
        //    $("#gridTable").jqGrid('setGridParam', {
        //        datatype: "jsonstring",
        //        datastr: data
        //    }).trigger("reloadGrid");
        //});
        var hsCode = $("#hsCode").val();
        var itemName = $("#itemName").val();
        var applyYyyy = $("#applyYyyy").val();

        $("#gridTable").jqGrid('setGridParam', {
            url: "@Url.Content("~/CommonModule/BmsCustomItem/GridListPageJson")?hsCode=" + hsCode + "&itemName=" + itemName + "&applyYyyy=" + applyYyyy, page: 1
        }).trigger('reloadGrid');
    }

    //新增
    function btn_add() {
        var url = "/CommonModule/BmsCustomItem/Form"
        openDialog(url, "Form", "新增海关编码", 770, 395, function (iframe) {
            top.frames[iframe].AcceptClick()
        });
    }
    //编辑
    function btn_edit() {
        var KeyValue = GetJqGridRowValue("#gridTable", "BMS_CUSTOM_ITEM_ID");
        if (IsChecked(KeyValue)) {
            var url = "/CommonModule/BmsCustomItem/Form?KeyValue=" + KeyValue;
            openDialog(url, "Form", "编辑海关编码", 570, 305, function (iframe) {
                top.frames[iframe].AcceptClick();
            });
        }
    }
    //删除
    function btn_delete() {
        var KeyValue = GetJqGridRowValue("#gridTable", "BMS_CUSTOM_ITEM_ID");
        if (IsDelData(KeyValue)) {
            var delparm = 'KeyValue=' + KeyValue;
            delConfig('/CommonModule/BmsCustomItem/Delete', delparm, KeyValue.split(",").length);
        }
    }
    //刷新
    function windowload() {
        $("#gridTable").trigger("reloadGrid"); //重新载入

    }

    //复制
    function btn_copy() {
        var url = "/CommonModule/BmsCustomItem/Copy"
        openDialog(url, "Form", "新增海关编码", 570, 195, function (iframe) {
            top.frames[iframe].AcceptClick()
        });
    }


</script>

<div class="tools_bar leftline rightline" style="margin-bottom: 0px; margin: 1px;">
    <div class="PartialButton">
        @Html.Partial("_PartialButton")
    </div>
</div>

<div class="leftline rightline QueryArea" style="margin: 1px; margin-top: 0px; margin-bottom: 0px;">
    <table border="0" class="form-find" style="height: 45px;">
        <tr>
            <th>海关编码：</th>
            <td>
                <input id="hsCode" type="text" class="txt" style="width: 200px" />
            </td>
            <th>商品名称：</th>
            <td>
                <input id="itemName" type="text" class="txt" style="width: 200px" />
            </td>
            <th>适用年份：</th>
            <td>
                <input id="applyYyyy" type="text" class="txt" style="width: 200px" />
            </td>
            <td>
                <input id="btnSearch" type="button" class="btnSearch" value="搜 索" onclick="btn_Search()" />
            </td>
        </tr>
    </table>
</div>
<div class="topline rightline" style="margin: 1px; margin-top: -1px;">
    <table id="gridTable"></table>
    <div id="gridPager"></div>
</div>  